package com.itheima.二维数组;

/*
      索引为偶数则加一
 */
public class Work08 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7};
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        change(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static void change(int[] arr) {
        for (int i = 0; i < arr.length; i += 2) {
            arr[i] += 1;
        }
    }
}
